<template>
  <div id="office">
    <el-row class="edit-title">
      <el-col :span="4">新增科室</el-col>
      <el-col :span="3" :push="17" class="text-right">
        <el-button
          class="back"
          type="info"
          size="mini"
          plain
          icon="el-icon-arrow-left"
          @click="goBack"
        >返回</el-button>
      </el-col>
    </el-row>
    <el-form :model="info" :rules="rules" ref="info" label-width="100px" class="el_t_20">
      <el-form-item label="科室名称：" prop="name">
        <el-row>
          <el-col :span="8">
            <el-input type="text" v-model="info.name" placeholder="请输入科室名称"></el-input>
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="状态：" prop="radio">
        <el-radio-group v-model="info.radio" size="mini">
          <el-radio-button :label="1">正常</el-radio-button>
          <el-radio-button :label="2">冻结</el-radio-button>
        </el-radio-group>
      </el-form-item>
    </el-form>
    <el-row class="footer-fixed">
      <el-col :span="24" class="text-right">
        <el-button type="primary" plain>取 消</el-button>
        <el-button type="primary" @click="submitInfo('info')">保 存</el-button>
      </el-col>
    </el-row>
  </div>
</template>
<script>
export default {
  name: "office",
  data() {
    return {
      info: {
        name: "",
        radio: 1,
        sex: "",
        checked: false
      },
      rules: {
        name: [
          { required: true, message: "医嘱名称不能为空", trigger: "blur" }
        ],
        radio: [
          { required: true, message: "请选择所属分类", trigger: "change" }
        ]
      }
    };
  },
  methods: {
    submitInfo(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("验证通过！");
        } else {
          return false;
        }
      });
    },
    goBack() {
      this.$router.go(-1);
    }
  }
};
</script>
<style scoped>
#office {
  width: 100%;
  height: calc(100vh - 108px);
  background: #ffffff;
  padding: 20px;
}
.edit-title {
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e4e4;
  color: #006835;
  font-weight: 700;
}
.upload {
  width: 80px;
  height: 80px;
  background: #f2f2f2;
  color: #999999;
  border: 1px solid #ccc;
  text-align: center;
  border-radius: 4px;
  line-height: 1;
  padding-top: 20px;
}
.upload i {
  font-size: 18px;
}
.info-name {
  font-weight: bold;
}
</style>


